@extends('layouts.admin')

@section('title', '管理员登录')

@section('content')
    <input type="hidden" id="TenantId" name="TenantId" value="" />
    <div class="header"></div>
    <div class="loginWraper">
        <div id="loginform" class="loginBox">
            @if (count($errors) > 0)
               <p class="error">{{$errors->first()}}</p>
            @endif
            <form class="form form-horizontal" action="{{url('auth/login')}}" method="post" id="form-login">
                <div class="row cl">
                    <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
                    <div class="formControls col-xs-8">
                        <input id="phone" name="phone" type="tel" placeholder="手机" value="{{ old('phone') }}" class="input-text size-L">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
                    <div class="formControls col-xs-8">
                        <input id="password" name="password" type="password" placeholder="密码" class="input-text size-L">
                    </div>
                </div>
                <div class="row cl">
                    <div class="formControls col-xs-8 col-xs-offset-3">
                        <input class="input-text size-L" type="text" name="captcha" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
                        <img id="captchaImg" src="{{url('captcha')}}?"+Math.random() onclick="this.src='{{url('captcha')}}?'+Math.random()"> <a id="kanbuq" href="javascript:change_captcha();">看不清，换一张</a> </div>
                </div>
                <div class="row cl">
                    <div class="formControls col-xs-8 col-xs-offset-3">
                        <input type="checkbox" name="remember" id="remember">
                        <label for="remember">使我保持登录状态</label>
                    </div>
                </div>
                <div class="row cl">
                    <div class="formControls col-xs-8 col-xs-offset-3">
                        <input  type="submit" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
                        {{--<input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">--}}
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="footer">Copyright 优易教育 by mingdongc v1.0</div>
@endsection

@section('script')
    <script>function change_captcha() {$("#captchaImg").attr("src","{{url('captcha')}}?"+Math.random());}</script>
    <script>
        $("#form-login").validate({
            rules:{
                phone:{
                    required:true,
                    isMobile:true,
                },
                password:{
                    required:true,
                },
                captcha:{
                    required:true,
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                form.submit();
            }
        });
    </script>
@endsection